using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

namespace OrbitOne.Elmah.Presenter
{
    public class SearchImageColumn : WebControl
    {
        public enum Direction
        {
            Right,
            Left
        }

        public string ImageCss { get; set; }
        public string ImageSource { get; set; }
        public Direction FloatDirection { get; set; }

        protected override void Render(HtmlTextWriter writer)
        {
            var container = new HtmlGenericControl("span");
            container.Attributes.Add("class", "searchimagecol " + FloatDirection.ToString().ToLowerInvariant());

            var image = new HtmlImage
                            {
                                Src = ("../img/" + ImageSource),
                                Alt = ToolTip
                            };
            image.Attributes.Add("title", ToolTip);
            image.Attributes.Add("class", ImageCss);

            container.Controls.Add(image);
            container.RenderControl(writer);
        }
    }
}